﻿// owner 蒋家伟

#pragma once
#include "IExcelWriter.h"

// thirdparty
#define max(a,b) (((a) > (b)) ? (a) : (b))

#include "xlnt/xlnt.hpp"


namespace jsdk
{
    class ExcelWriter : public IExcelWriter
    {
    public:
        static OwnerPtr<ExcelWriter> create(const std::wstring& fileName);
        ~ExcelWriter();
    private: 
        virtual uint64_t addSheet(const std::wstring& sheetName) override;
        virtual bool openSheet(uint32_t sheetIndex) override;
        virtual bool setCellData(uint32_t row, uint32_t col, const std::wstring& valueStr) override;
        virtual bool deleteSheet(const std::wstring& sheetName) override;
        virtual bool save() const;
        // owner
        ExcelWriter() {};
    private:
        xlnt::workbook m_workBook{};
        xlnt::worksheet m_workSheet{};
        std::wstring m_fileName;
    };
}